package com.fire.control.system.entity;

import java.util.Collection;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

import com.fire.control.system.statics.Status_Warning;
import com.fire.control.system.statics.Type_SureWarning;

@Entity
@Table(name = "t_warning_info")
public class WarningInfo extends BaseEntity{

	private static final long serialVersionUID = 1L;
	
	@ManyToOne(fetch = FetchType.EAGER)
    @JoinColumn(name="target_device_id")
	private Device targetDevice;
	
	@Column
	private String companyId;
	
	@Transient
	private String targetDeviceId;
	@Column
	private String warningType;
	
	@Column(name = "sure_warning_type", nullable = false,length=20)
	@Enumerated(EnumType.STRING)
	private Type_SureWarning sureWarning;  
	
	@Column(name = "warning_desc")
	private String warningDesc;
	
	@Column(name = "address", nullable = false)
	private String address;
	
	@OneToOne 
    @JoinColumn(name="warning_level_id",nullable = false )
	private WarningLevel warningLevel;
	
	@OneToMany(fetch = FetchType.LAZY, mappedBy = "warningInfo")
	private Collection<WarningHandle> warningHandles;
	
	@Column(name = "start_time", nullable = false)
	@Temporal(TemporalType.DATE)
	private Date startTime;
	
	@Column(name = "current_status", nullable = false,length=20)
	@Enumerated(EnumType.STRING)
	private Status_Warning currentStatus;
	
	@Transient
	private String currentStatusVal;
	
	@Column(name = "trustees")
	private String trustees;
	
	@Column(name = "end_time")
	@Temporal(TemporalType.DATE)
	private Date endTime;
	
	@Column
	private Boolean fix = false;
	
	
	public String getWarningType() {
		return warningType;
	}

	public void setWarningType(String warningType) {
		this.warningType = warningType;
	}

	public String getTargetDeviceId() {
		return targetDeviceId;
	}

	public void setTargetDeviceId(String targetDeviceId) {
		this.targetDeviceId = targetDeviceId;
	}

	public Boolean getFix() {
		return fix;
	}

	public void setFix(Boolean fix) {
		this.fix = fix;
	}

	public Type_SureWarning getSureWarning() {
		return sureWarning;
	}

	public void setSureWarning(Type_SureWarning sureWarning) {
		this.sureWarning = sureWarning;
	}

	public Device getTargetDevice() {
		return targetDevice;
	}

	public void setTargetDevice(Device targetDevice) {
		this.targetDevice = targetDevice;
	}

	public String getWarningDesc() {
		return warningDesc;
	}

	public void setWarningDesc(String warningDesc) {
		this.warningDesc = warningDesc;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public Date getStartTime() {
		return startTime;
	}

	public void setStartTime(Date startTime) {
		this.startTime = startTime;
	}

	public Status_Warning getCurrentStatus() {
		return currentStatus;
	}

	public void setCurrentStatus(Status_Warning currentStatus) {
		this.currentStatus = currentStatus;
	}


	public String getTrustees() {
		return trustees;
	}

	public void setTrustees(String trustees) {
		this.trustees = trustees;
	}

	public Date getEndTime() {
		return endTime;
	}

	public void setEndTime(Date endTime) {
		this.endTime = endTime;
	}

	public WarningLevel getWarningLevel() {
		return warningLevel;
	}

	public void setWarningLevel(WarningLevel warningLevel) {
		this.warningLevel = warningLevel;
	}

	public Collection<WarningHandle> getWarningHandles() {
		return warningHandles;
	}

	public void setWarningHandles(Collection<WarningHandle> warningHandles) {
		this.warningHandles = warningHandles;
	}
	

	public String getCurrentStatusVal() {
		return currentStatusVal;
	}

	public void setCurrentStatusVal(String currentStatusVal) {
		this.currentStatusVal = currentStatusVal;
	}

	public String getCompanyId() {
		return companyId;
	}

	public void setCompanyId(String companyId) {
		this.companyId = companyId;
	}


	
	
}
